console.log('---------------------------------------手写继承-------------------------------------------')

// 1
function Parent() {
    this.name = '胖鸡'
}
function child() {
    this.age = 18
}
let rest = new Parent()
child.prototype = rest;
var s = new child()
console.log(s.age)

// 原型链
function Dad(name) {
    this.name = name
}
function son(age) {
    Dad.call(this, '胖鸡')
    this.age = age
}

var proto = new son(16)
console.log(proto.age)
console.log(proto.name)

// 组合继承
function Dog(name) {
    this.name = name
}
Dog.prototype.love = "吃饭";
function cat(age) {
    Dog.call(this, '小猫');
    this.age = age
}

cat.prototype = new Dog()
var t = new cat(6)
console.log(t.name)
console.log(t.age)
console.log(t.love)































